<template>
  <router-view />
</template>

<script>
import { provide, ref } from 'vue'
import { router } from './router'

export default {
  name: 'App',
  setup() {
    let width = document.documentElement.clientWidth
    const asideVisible = ref(width <= 500 ? false : true)
    provide('asideVisible', asideVisible)

    const resize = window.addEventListener('resize', () => {
      width = document.documentElement.clientWidth
      if (width <= 500) {
        asideVisible.value = false
      } else {
        asideVisible.value = true
      }
    })

    router.afterEach(() => {
      if (width <= 500) {
        asideVisible.value = false
      } 
    })
  },
}
</script>
